/**
 * uniBoard AdminCP Specific JS
 *
 * Light and fast forum solution for web 2.0-like communities.
 *
 * @package		uniBoard
 * @author		Rafał Pitoń
 * @license		http://www.gnu.org/licenses/gpl-3.0.html
 * @since		Version 0.1
 * 
 * ------------------------------------------------------------------------
 * 
 * $Date: 2010-09-15 17:35:38 +0000 (Wed, 15 Sep 2010) $
 * $Revision: 61 $
 * $Author: rafio.xudb@gmail.com $
 */
 
 $(document).ready( function(){
	var anims_speed = 200;
	$('.popup_button').click( function(){
		var container = $(this).parent('.popup_container');
		if ( container.children('.popup_window').is(':visible'))
		{
			container.children('.popup_window').slideUp( anims_speed);
			$(this).toggleClass('popup_button_on', false);
		}
		else
		{
			$('.popup_window:visible').slideUp( anims_speed);
			$('.popup_button').toggleClass('popup_button_on', false);
			
			container.children('.popup_window').slideDown( anims_speed);
			$(this).toggleClass('popup_button_on', true);
		}
		return false;
	});
	$('body').click( function(){
		$('.popup_window:visible').slideUp( anims_speed);
		$('.popup_button').toggleClass('popup_button_on', false);
	});
	$( '.checkbox_master').click( function(){
		if($(this).attr('checked'))
		{
			$('.checkbox_children').attr('checked','checked');
		}
		else
		{
			$('.checkbox_children:checked').removeAttr('checked');
		}
	});
	$( '.checkbox_children').click( function(){
		if( !$(this).attr('checked'))
		{
			$('.checkbox_master:checked').removeAttr('checked');
		}
	});
});

function massSelect( parent){
	$(document).ready( function(){
		$('#' + parent + ' input').attr('checked','checked');
	});
}

function massClear( parent){
	$(document).ready( function(){
		$('#' + parent + ' input:checked').removeAttr('checked');
	});
}